import webview


class Api:
    # @staticmethod
    def open_python_file_dialog(self):
        result = window.create_file_dialog(
            webview.OPEN_DIALOG, allow_multiple=False, file_types=('Python Files (*.py)', 'All files (*.*)')
        )
        return result

    def open_icon_file_dialog(self):
        result = window.create_file_dialog(
            webview.OPEN_DIALOG, allow_multiple=False, file_types=('Icon Files (*.ico;*.png;*.svg)', 'All files (*.*)')
        )
        return result


if __name__ == '__main__':
    url = 'http://localhost:5173/'
    window = webview.create_window('Pyinstaller可视化', url, js_api=Api(), width=1280, height=800)
    webview.start()
